package com.ibeeking.found.system.api.feign.fallback;

import com.ibeeking.found.system.api.common.param.RefreshTokenParam;
import com.ibeeking.found.system.api.feign.UaaBClient;
import com.ibeeking.nematos.utils.result.ResponseResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 降级工场
 *
 * @Author ibeeking
 * @date 2019/1/18
 */
@Component
public class UaaBClientFallbackFactory implements FallbackFactory<UaaBClient> {
    @Override
    public UaaBClient create(Throwable throwable) {
        return new UaaBClient() {

            @Override
            public ResponseResult<String> refreshToken(RefreshTokenParam refreshTokenParam) {
                return ResponseResult.fail(throwable.getMessage());
            }
        };
    }
}
